package com.easyjob.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Const
 */
@Configuration
public class RabbitMqConfig {

    @Bean
    public Queue autoSaveQueue() {
        return new Queue("exam.autoSave");
    }

    @Bean
    public TopicExchange examExchange() {
        return new TopicExchange("exam.exchange");
    }

    @Bean
    public Binding autoSaveBinding() {
        return BindingBuilder.bind(autoSaveQueue())
                .to(examExchange())
                .with("exam.autoSave");
    }
}
